package pl.edu.mimuw.irs.rcp.controller.editor.util.command;

import org.eclipse.gef.commands.Command;

import pl.edu.mimuw.irs.core.model.design.resource.IHolder;
import pl.edu.mimuw.irs.core.model.design.resource.IMember;

public class AddMemberCommand extends Command {

	// *** Attributes

	@SuppressWarnings("unchecked")
	private IHolder holder;
	private IMember member;
	public IMember getMember() {
		return member;
	}
	
	// *** Constructors
	
	@SuppressWarnings("unchecked")
	public AddMemberCommand(IHolder holder, IMember member) {
		this.holder = holder;
		this.member = member;
	}
	
	// *** Methods
	
	@SuppressWarnings("unchecked")
	@Override
	public void execute() {
		holder.add(member);
		super.execute();
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public void undo() {
		holder.remove(member);
		super.undo();
	}
}
